package cn.wolfcode.p2p.controller;

import cn.wolfcode.p2p.base.domain.RealAuth;
import cn.wolfcode.p2p.base.domain.UserInfo;
import cn.wolfcode.p2p.base.query.BidRequestQuery;
import cn.wolfcode.p2p.base.service.IRealAuthService;
import cn.wolfcode.p2p.base.service.IUserInfoService;
import cn.wolfcode.p2p.business.domain.BidRequest;
import cn.wolfcode.p2p.business.service.IBidRequestService;
import cn.wolfcode.p2p.util.Constants;
import cn.wolfcode.p2p.util.PageResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class IndexController {
        @Autowired
        private IBidRequestService bidRequestService;
      /*  @Autowired
        private IUserInfoService userInfoService;
        @Autowired
        private IRealAuthService realAuthService;*/
        @RequestMapping("index")
        public String index(Model model){
                List<BidRequest> list = bidRequestService.queryPublishPendng();
                //修改查询bidrequests的方法,根据多个状态查,5条,根据状态升序排序,未做
                model.addAttribute("publishPendngBidRequests",list);
                List<BidRequest>bidRequests =  bidRequestService.listBidRequestBiding();
                model.addAttribute("bidRequests",bidRequests);
                return "main";
        }

    /*    @RequestMapping("borrow_info")
        public String borrowInfo(Model model,Long id){
                BidRequest bidRequest = bidRequestService.getById(id);
                UserInfo userInfo = userInfoService.getById(bidRequest.getCreateUser().getId());
                RealAuth realAuth = realAuthService.getById(userInfo.getRealAuthId());
                model.addAttribute("bidRequest",bidRequest);
                model.addAttribute("userInfo",userInfo);
                model.addAttribute("realAuth",realAuth);
                return "/bidrequest/borrow_info";
        }*/


}
